<?php $this->_extends('_layouts/bocib_layout'); ?>

<?php $this->_block('content');?>
<div id="content">
    <h2>编辑文章</h2>
    <p class="jump"><a href="<?=url('bonewsnotice/addnews');?>">添加新闻 >></a></p>
    <p class="jump"><a href="<?=url('bonewsnotice/listnews');?>">查看所有新闻 >></a></p>
    <form action="<?=url('bonewsnotice/editnews');?> " method="post" enctype="multipart/form-data">
        <div>
            <?php $news = News::find('news_id = ?', $_GET['news_id'])->query();?>
            <input type="hidden" name="news_id" value="<?=$news->news_id;?>" />
            <label for="title">文章标题:</label><br />
            <input type="text" name="title" id="title" value="<?=$news->title;?>" size="75px" /> <br />
            <label for="ctgry_id">选择分类:</label>
            <select name="ctgry_id" id="ctgry_id">
                <option value="<?=$news->category_id;?>" selected="selected">当前为"<?=$news->category->category;?>"</option>
                <?php foreach(NewsCategory::find('haschild != 1')->all()->query() as $ctgry) { ?>
                <option value="<?=$ctgry->id;?>"><?=$ctgry->category;?></option>
                <?php } ?>
            </select><br />
            <label for="publisher">文章发布:</label>
            <input type="text" name="publisher" id="publisher" value="<?=$news->publisher;?>" /><br />
            <label>是否置顶:</label>
            <label>是</label>
            <input type="radio" name="sticky" value="1" <?php if($news->sticky == 1) { ?> checked="checked" <?php } ?>>
            <label>否</label>
            <input type="radio" name="sticky" value="0" <?php if($news->sticky == 0) { ;?> checked="checked" <?php } ?>><br />
            <label for="isprivate">外部可视:</label>
            <label>是</label>
            <input type="radio" name="isprivate" value="0" <?php if($news->isprivate == 0) { ?> checked="checked" <?php } ?>>
            <label>否</label>
            <input type="radio" name="isprivate" value="1" <?php if($news->isprivate == 1) { ?> checked="checked" <?php } ?>>
            <label><span class="stips pdl20">(选择"是"表示无需登录即可查看该新闻)</span></label><br />
            <label>发布时间:</label>
            <label>20</label>
            <select name="ayear">
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09" selected="selected">09</option>
                <?php for($baseyear=10;$baseyear<20;++$baseyear) { ?>
                <option value="<?=$baseyear;?>"><?=$baseyear;?></option>
                <?php } ?>
            </select><label>年</label>
            <select name="amonth">
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
            </select><label>月</label>
            <select name="aday">
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <?php for($baseday=10;$baseday<32;++$baseday) { ?>
                <option value="<?=$baseday;?>"><?=$baseday;?></option>
                <?php } ?>
            </select><label>日</label>
            <input type="checkbox" name="reserveAdate" value="1" checked="checked" /><label>保持原有日期: <?= $news->adate;?></label>
            <br />
            <label><span class="tips">如果未选择日期，即日期为"2009-01-01"，系统将使用当前日期作为新闻发布时间</span></label><br />
            <label for="tag">新闻标签:</label>
            <input type="text" value="<?=trim($news->tag, ',');?>" name="tag" id="tag" /><label><span class="stips pdl20"> (可选)搜索关键字，多个标签请用","(英语逗号)隔开</span></label><br />
            <label>已有标签：
				<ul>
					<li>
						<b>新闻通知标签：</b>
				<?php foreach(Tag::find('category = ?', '新闻通知')->all()->query() as $tag) { ?>
					<a href="#"><?=$tag->tag;?></a>
				<?php } ?>
				</li> 
				<li><b>国际交流标签：</b>
				<?php foreach(Tag::find('category = ?', '国际交流')->all()->query() as $tag) { ?>
					<a href="#"><?=$tag->tag;?></a>
				<?php } ?>
				</li> 
				<li><b>创新实践标签：</b>
				<?php foreach(Tag::find('category = ?', '创新实践')->all()->query() as $tag) { ?>
					<a href="#"><?=$tag->tag;?></a>
				<?php } ?>
				</li>
				</label><br />
            <label>内容<span class="highlight">请注意:新闻插图文件请勿使用中文文件名，否则将无法上传</span>,上传插图请点击<img src="misc/fck_upload_icon.png" alt="" />（第四排第一个图标），选择"上传"</label>

			<?php $this->_control('fckeditor', 'body' , array('base_dir' => '/misc/fckeditor','value'=>$news->body)); ?>
			<br />

            <br />
            <label>附件:<span class="stips">(可选)jpg,png,gif, doc,docx,ppt,pptx,xls,xlsx, txt,pdf, rar,zip,tgz, mp3, 最大尺寸 8M</span></label>
            <ul>
            <?php foreach($news->attachments as $key => $attachment) { ?>
            <li><?=$key+1;?>. <?=$attachment->filename;?><a href="<?=url('bonewsnotice/deleteattachment', array('attachment_id'=>$attachment->attachment_id, 'news_id'=>$news->news_id));?>">删除</li></a><br />
            <?php } ?>
            <li><input type="file" name="attachment[]" value="浏览" /></li>
            <li><input type="file" name="attachment[]" value="浏览" /></li>
            <li><input type="file" name="attachment[]" value="浏览" /></li>
            <li><input type="file" name="attachment[]" value="浏览" /></li>
            <li><input type="file" name="attachment[]" value="浏览" /></li>
            <input type="submit" value="提交" />
        </div>
    </form>
</div>
<?php $this->_endblock('content');?>